import {
    getOrganism,
    getTemperatures,
    getChlorophyll,
    getRedTideNews,
    getRedTideDistribution,
    getRedTideDiscovery, getRedTideArea
} from "@/service/modules/discover";
import {defineStore} from "pinia";
import yhRequest from "@/service/request";

const useDiscoverStore = defineStore("discoverStore", {
    state: () => ({
        organism: {},
        temperatures:[],
        chlorophyll:[],
        redTideNews:{},
        redTideDistribution:[],
        redTideDiscovery:{},
        redTideArea:{}

    }),
    actions: {
        async fetchOrganism() {
            this.organism = await getOrganism()
        },
        async fetchTemperatures() {
            this.temperatures = await getTemperatures()
        },
        async fetchChlorophyll() {
            this.chlorophyll = await getChlorophyll()
        },
        async fetchRedTideNews(){
            this.redTideNews = await getRedTideNews()
        },
        async fetchRedTideDistribution(){
            this.redTideDistribution=await getRedTideDistribution()
        },
        async fetchRedTideDiscovery(){
            this.redTideDiscovery=await getRedTideDiscovery()
        },
        async fetchRedTideArea(){
            this.redTideArea=await getRedTideArea()
        }
    }
})
export default useDiscoverStore